#ifndef _HASH_MAP_H
#define	_HASH_MAP_H
namespace share
{

template< class KEY, class VALUE >
class hash_map
{
public:
	typedef std::pair<KEY, VALUE> value_type;
	typedef typename std::list<value_type>::iterator iterator;
	typedef const iterator	const_iterator;
	typedef typename std::pair<iterator, bool> insert_result;

public:
	hash_map( void );

	~hash_map( void );

	iterator find( const KEY & k );

	void erase( iterator it );

	void erase( const KEY & k );

	insert_result insert( const value_type &value );
	insert_result insert( const KEY &k, const VALUE &v );

	bool empty( ) const
	{
		return values_.empty( );
	}

	const_iterator begin( )
	{
		return values_.begin( );
	}

	const_iterator end( )
	{
		return values_.end( );
	}

private:

	struct bucket_type
	{
		iterator begin;
		iterator end;
	};

	iterator value_insert( iterator it, const value_type &value );
	void value_erase( iterator it );

	enum
	{
		buckets_num_ = 1024
	};

	bucket_type		buckets_[ buckets_num_ ];
	std::list<value_type>	values_;
	std::list<value_type>	spares_;
};

#include "hash_map.cpp"

}
#endif // 
